// File Name: servo_tools.c
// Author: kukukukuku~
// Date: 2025-03-10

#include "./Servo/inc/servo_tools.h"

/**
 * @brief   Servo计算角度对应的定时器通道值
 * @param   degree: 舵机角度
 * @retval  舵机角度对应的定时器通道值
 * @note    None
*/
uint16_t servo_pulse_calculate(const uint8_t degree)
{
    return degree > 180 ? 2500 - 1 : (uint16_t)(degree * 11.11 + 500.5) - 1;
}
